package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by yanwt on 2017/1/4.
 * 家长问题表
 */
@Getter
@Setter
@Entity
@Table(name = "tb_parent_question")
@org.hibernate.annotations.Table(appliesTo = "tb_parent_question",comment = "家长问题表")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="parent_question", usage = CacheConcurrencyStrategy.READ_WRITE)
public class ParentQuestionEntity extends DataEntity {
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    @ManyToOne
    @JoinColumn(name="parent_id",columnDefinition=("bigint(20) default null comment '家长ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private ParentEntity parent;
    @Column(columnDefinition=("text default null comment '问题内容'"))
    private String content;

    @Column(name="post_time",columnDefinition=("datetime default null comment '提问时间'"))
    private Timestamp postTime;
    @ManyToOne(fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name="teacher_id",columnDefinition=("bigint(20) default null comment '班主任ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private TeacherEntity teacher;
    @Column(columnDefinition=("text default null comment '回复内容'"))
    private String reply;
    @Column(name="reply_time",columnDefinition=("datetime default null comment '回复时间'"))
    private Timestamp replyTime;
    @Column(columnDefinition="int(1) not null comment '问题状态 0:新建 1:回复'")
    private int status;
}
